import request from '@/utils/request';

export async function getBomReviewByPage (params: any) {
    return request('/api/design/getBomReviewByPage', {
    method: 'POST',
    data: params,
  });
}

//获得BOM审批的主表
export async function getBomReviewMainByPage (params: any) {
  return request('/api/design/getBomReviewMainByPage',{
    method: 'POST',
    data: params,
  });
}

export async function addBomReview (params: any) {
    return request('/api/design/addBomReview', {
    method: 'POST',
    data: params,
  });
}

export async function delBomReviewByIds (para: any) {
  return request('/api/design/delBomReviewByIds', {
    method: 'POST',
    params: {
      ids: para,
    }
  });
}


export async function updateBomReview (params: any) {
    return request('/api/design/updateBomReview', {
    method: 'POST',
    data: params,
  });
}

export async function delBomReview (params: any) {
    return request('/api/design/delBomReview', {
    method: 'POST',
    data: params,
  });
}

export async function exportBomReview(params: any) {
    return request('/api/design/exportBomReview', {
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

// BOM审批
export async function confirmBomReview(para: any) {
  return request('/api/design/confirmBomReview', {
    method: 'POST',
    requestType: 'form',
    params: {
      id: para.id,
      reviewState: para.reviewState,
      reviewMemo: para.reviewMemo,
    },
  });
}

//新 BOM审批
export async function confirmBomReviewVersion2(para: any){
  return request('/api/design/confirmBomReviewVersion2',{
    method: 'POST',
    params: {
      id: para.id,
      reviewState: para.reviewState,
      reviewMemo: para.reviewMemo,
      version: para.version,
      versionSecond: para.versionSecond,
      version_pre: para.version_pre,
      versionSecond_pre: para.versionSecond_pre,
    }
  })
}
export default { getBomReviewByPage, addBomReview, updateBomReview, delBomReview, exportBomReview }
